home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / c / ExtrasLib.lha / ExtrasLib / Source / Layout.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  33.6 KB  |  1,334 lines

  1. #include <extras/math.h>
  2. #include <clib/extras/layoutgt_protos.h>
  3. #include <clib/extras_protos.h>
  4.  
  5. #include <exec/memory.h>
  6.  
  7. #include <extras/layoutgt.h>
  8. #include <extras/gui.h>
  9. #include <extras/ext_text.h>
  10.  
  11. #include <intuition/gadgetclass.h>
  12.  
  13. #include <proto/dos.h>
  14. #include <proto/exec.h>
  15. #include <proto/gadtools.h>
  16. #include <proto/graphics.h>
  17. #include <proto/intuition.h>
  18. #include <proto/utility.h>
  19. #include <proto/diskfont.h>
  20.  
  21. #include <tagitemmacros.h>
  22. #include <math.h>
  23. #include <string.h>
  24. #include <stdio.h>
  25.  
  26. ULONG KeyTag[]=
  27. {
  28.   0,  //GENERIC_KIND    0
  29.   0,  //BUTTON_KIND    1
  30.   GTCB_Checked,   //CHECKBOX_KIND    2
  31.   GTIN_Number,    //INTEGER_KIND    3
  32.   GTLV_Selected,  //LISTVIEW_KIND    4
  33.   GTMX_Active,    //MX_KIND        5
  34.   0,              //NUMBER_KIND    6
  35.   GTCY_Active,    //CYCLE_KIND    7
  36.   GTPA_Color,     //PALETTE_KIND    8
  37.   GTSC_Top,       //SCROLLER_KIND    9
  38.   0,              //10
  39.   GTSL_Level,     //SLIDER_KIND    11
  40.   0,              //STRING_KIND    12
  41.   0               //TEXT_KIND    13
  42. };
  43.  
  44. struct CAndGI
  45. {
  46.   struct LG_Control *Control;
  47.   struct LG_GadgetIndex *GIndex;
  48. };
  49.  
  50. struct LG_GadgetIndex *LG_GetGI(struct LG_Control *Con, ULONG GadID);
  51. void lg_SetGadgetIndexAttrs(struct LG_GadgetIndex *GI, struct TagItem *TagList);
  52. //WORD lg_FigureDim(struct LG_Control *Con, ULONG Code, struct IBox *Bounds,struct lg_DimInfo *Data);
  53. BOOL LG_GetCAndGI(struct LG_Control *Con, ULONG GadID, struct CAndGI *CGI);
  54.  
  55. struct TextAttr lg_Topaz8=
  56. {
  57.   "topaz.font",
  58.   8,0,0
  59. };
  60.  
  61.  
  62. void lg_FixTagList(struct LG_Control *Con, struct TagItem *TagList);
  63.  
  64.  
  65. /****** extras.lib/OBSOLETE_LG_CreateGadgets ******************************************
  66. *
  67. *   OBSOLETE
  68. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  69. *
  70. *   NAME
  71. *       LG_CreateGadgets -- Create multiple Gadtools gadgets.
  72. *
  73. *   SYNOPSIS
  74. *       gcontrol = LG_CreateGadgets(Tags)
  75. *
  76. *       struct LG_Control *LG_CreateGadgets(Tag Tags, ...);
  77. *
  78. *   FUNCTION
  79. *       Creates multiple Gadtools, with some layout options.
  80. *
  81. *   INPUTS
  82. *       Tags (see <extras/layougtgt.h>)
  83. *
  84. *         LG_LeftEdge, LG_XPos - Position of gadget
  85. *         LG_TopEdge,  LG_YPos - Position of gadget
  86. *             The position of the gadget will depend on these attributes
  87. *             and the LG_Justification attribute.  Also see the relational
  88. *             macros in <extras/layoutgt.h>
  89. *         LG_Width  - Gadget width
  90. *         LG_Height - Gadget height
  91. *
  92. *           for the following see the NewGadget structure in 
  93. *           <libraries/gadtools.h>
  94. *         LG_GadgetText
  95. *         LG_TextAttr
  96. *         LG_GadgetID
  97. *         LG_Flags
  98. *         LG_VisualInfo
  99. *         LG_UserData
  100. *         LG_GadgetKind
  101. *         LG_GadgetTags
  102. *         LG_GadgetTagList
  103. *
  104. *         LG_OffsetX - global offset from left of window
  105. *         LG_OffsetY - global offset from top of window 
  106. *            These two set to topleft of the domain.
  107. *            Also these will be added to LG_UseScreenOffsets
  108. *            or LG_UseWindowOffsets if set.
  109. *
  110. *         LG_LabelFlags - see LGLF_ 
  111. *
  112. *         LG_ScaleX - Multiply gadget width and position by these.
  113. *                     (percent * 65536)
  114. *         LG_ScaleY - Multiply gadget height and position by these.
  115. *                     (percent * 65536)
  116. *
  117. *         LG_Justification - Sets the "handle" of the gadget.
  118. *
  119. *         LG_UseScreenOffsets - Sets global offsets based on Window border 
  120. *                           dimensions specified in the Screen structure
  121. *         LG_UseWindowOffsets - Sets global offsets based on Window border 
  122. *                           dimensions
  123. *
  124. *         LG_EraseRemoved - If set gadgets erase themselves when they are 
  125. *                           removed using LG_RemoveGadgets
  126. *
  127. *         LG_KeyClass  - Not used 
  128. *         LG_KeyString - A string of characters that "activate" that 
  129. *              gadget, if not specified, LG_CreateGadget() will scan 
  130. *              the gadget label for the appropriate string.  This 
  131. *              attribute is cleared after each LG_CreateGadget
  132. *               attribute
  133. *         LG_ErrorCode - Not used
  134. *
  135. *         LG_Bounds - set offsets or domain area for gadgets
  136. *         LG_BoundsLeft   - Left of domain. (Alias for LG_OffsetX)
  137. *         LG_BoundsTop    - Top of domain.  (Alias for LG_OffsetY)
  138. *         LG_BoundsWidth  - Width of domain.
  139. *         LG_BoundsHeight - Height of domain.
  140. *
  141. *         LG_RelHorizGap - Gap between certain relative operations
  142. *         LG_RelVertGap  - Gap between certain relative operations
  143. *
  144. *         LG_HorizCells - Sets the number of columns in a table.
  145. *         LG_VertCells - Sets the number of rows in a table. 
  146. *           Sets the number of cells in a table.  The table's pixel size
  147. *           is the current LG_Bound size.  These attributes work in 
  148. *           conjunction with the LG_REL_CELL_ macros defined in 
  149. *           <extras/layoutgt.h>
  150. *           
  151. *         LG_SkipGadgets - Skip the next ti_Data LG_CreateGadgets and 
  152. *           all Tags in between.
  153. *
  154. *   RESULT
  155. *       returns NULL on failure, or a pointer the LG_Control structure 
  156. *       defined in <extras/layoutgt.h>
  157. *
  158. *   EXAMPLE
  159. *       See the supplied example, if there are any.
  160. *
  161. *   NOTES
  162. *       Gadgets created by LG_CreateGadgets() Must be freed using 
  163. *       LG_FreeGadgets OR Removed from it's Window using 
  164. *       LG_RemoveGadgets *BEFORE* the window is closed
  165. *
  166. *   BUGS
  167. *
  168. *   SEE ALSO
  169. *       LG_FreeGadgets, LG_RemoveGadgets, LG_AddGadgets, LG_RemoveGadgets,
  170. *
  171. ******************************************************************************
  172. *
  173. */
  174.  
  175.  
  176. struct LG_Control * LG_CreateGadgets(Tag Tags, ...)
  177. {
  178.   return(LG_CreateGadgetsA((struct TagItem *)&Tags));
  179. }
  180.  
  181. struct LG_Control * LG_CreateGadgetsA(struct TagItem *TagList)
  182. {
  183.   BOOL lg_debug=0;
  184.   struct Screen     *lg_usescreenoffsets;
  185.   struct Window     *lg_usewindowoffsets;
  186.   struct IBox       bounds={0,0,0,0};
  187.   struct LG_Control *control;
  188.   struct Gadget     *gad=0,*gctr,**cgptr;
  189.   struct NewGadget  newgadget={0},
  190.                     workgadget;
  191.   struct TagItem    *ngtaglist=0,
  192.                     *tag, 
  193.                     *tstate;
  194.   struct lg_DimInfo diminfo;
  195.   ULONG   lg_justification=0;
  196.   WORD    lg_swoffsetx=0,lg_swoffsety=0;
  197.   float   lg_scalex=1,lg_scaley=1;
  198.   ULONG   ngkind=0,
  199.           data,
  200.           lg_leftedge,lg_topedge,lg_width,lg_height,
  201.           gadcount=0,
  202.           fitlabel=0,
  203.           ls_left, ls_right, ls_top, ls_bottom,  // Label Size
  204.           js_left, js_right, js_top, js_bottom,
  205.           js2_left, js2_right, js2_top, js2_bottom;  // Just. label Size
  206.   LONG    *lg_getminwidth,
  207.           *lg_getminheight;
  208. //          *lg_addminwidth,
  209. //          *lg_addminheight;
  210.   struct TextFont *tf;
  211.   WORD labelwidth, labelheight;
  212.   ULONG gi_keyclass=0;
  213.   STRPTR gi_keystring=0;
  214.   UBYTE  gi_kstring[3];
  215.   LONG *errorptr;
  216.   
  217.   memset(&diminfo,0,sizeof(diminfo));
  218.   lg_topedge=lg_leftedge=lg_width=lg_height=0;
  219.  
  220.   if(control=AllocMem(sizeof(struct LG_Control),MEMF_CLEAR))
  221.   {
  222.     control->lgc_Next=0;
  223.     if(errorptr=(LONG *)GetTagData(LG_ErrorCode,0,TagList))
  224.       *errorptr=-1;
  225.     
  226.     
  227.     ProcessTagList(TagList,tag,tstate)
  228.     {
  229.       switch(tag->ti_Tag)
  230.       {
  231.         case LG_SkipGadgets:
  232.           {
  233.             ULONG skip;
  234.         
  235.             skip=tag->ti_Data;
  236.             while(skip>0)
  237.             {
  238.               if(!(tag=NextTagItem(&tstate)))
  239.                 skip=0;
  240.               if(tag->ti_Tag==LG_CreateGadget)
  241.                 skip--;
  242.             }
  243.           }
  244.           break;
  245.         case LG_CreateGadget:
  246.           gadcount++;
  247.           break;
  248.       }
  249.     }
  250.     if(control->lgc_GadgetIndex=AllocVec(gadcount * sizeof(struct LG_GadgetIndex),MEMF_CLEAR))
  251.     {
  252.       control->lgc_Left=control->lgc_Top=32767;
  253.       control->lgc_Right=control->lgc_Bottom=0;
  254.       gad=CreateContext(&control->lgc_GadgetList);
  255.   
  256.       ProcessTagList(TagList,tag,tstate)
  257.       {
  258.         data=tag->ti_Data;
  259.         switch(tag->ti_Tag)
  260.         {
  261.           case LG_SkipGadgets:
  262.             {
  263.               ULONG skip;
  264.           
  265.               skip=tag->ti_Data;
  266.               while(skip>0)
  267.               {
  268.                 if(!(tag=NextTagItem(&tstate)))
  269.                   skip=0;
  270.                 if(tag->ti_Tag==LG_CreateGadget)
  271.                   skip--;
  272.               }
  273.             }
  274.             break;
  275.           case LG_DebugMode:
  276.             lg_debug=data;
  277.             break;
  278.           case LG_NewGadget:
  279.             newgadget=*((struct NewGadget *)data);
  280.             lg_leftedge =newgadget.ng_LeftEdge;
  281.             lg_topedge  =newgadget.ng_TopEdge;
  282.             lg_width    =newgadget.ng_Width;
  283.             lg_height   =newgadget.ng_Height;
  284.             break;
  285.           case LG_LeftEdge:
  286.             lg_leftedge=data;
  287.             break;
  288.           case LG_TopEdge:
  289.             lg_topedge=data;
  290.             break;
  291.           case LG_Width:
  292.             lg_width=data;
  293.             break;
  294.           case LG_Height:
  295.             lg_height=data;
  296.             break;
  297.           case LG_GadgetText:
  298.             newgadget.ng_GadgetText=(UBYTE *)data;
  299.             break;
  300.           case LG_TextAttr:
  301.             newgadget.ng_TextAttr=(struct TextAttr *)data;
  302.             break;
  303.           case LG_GadgetID:
  304.             newgadget.ng_GadgetID=data;
  305.             break;
  306.           case LG_Flags:
  307.             newgadget.ng_Flags=data;
  308.             break;
  309.           case LG_VisualInfo:
  310.             newgadget.ng_VisualInfo = (void *)data;
  311.             break;
  312.           case LG_UserData:
  313.             newgadget.ng_UserData=(void *)data;
  314.             break;
  315.           case LG_GadgetKind:
  316.             ngkind=data;
  317.             break;
  318.           case LG_GadgetTagList:
  319.             if(ngtaglist)  
  320.               FreeTagItems(ngtaglist);
  321.             if((!(ngtaglist=CloneTagItems((struct TagItem *)data))) && data )
  322.               gad=0;
  323.             else
  324.               lg_FixTagList(control,ngtaglist);
  325.               
  326.             break;
  327.           case LG_GadgetTags:
  328.             if(ngtaglist)
  329.               FreeTagItems(ngtaglist);
  330.             if(ngtaglist=AllocateTagItems(data+1))
  331.             {
  332.               LONG tagcnt;
  333.               
  334.               for(tagcnt=0;(tagcnt<data) && (tag=NextTagItem(&tstate));tagcnt++)
  335.               {
  336.                 ngtaglist[tagcnt].ti_Tag =tag->ti_Tag;
  337.                 ngtaglist[tagcnt].ti_Data=tag->ti_Data;
  338.               }
  339.               ngtaglist[data].ti_Tag=TAG_DONE;
  340.               lg_FixTagList(control,ngtaglist);
  341.             }
  342.             else
  343.               gad=0;  
  344.             break;
  345.           case LG_LabelFlags:
  346.             fitlabel=data & LGLF_FITLABEL;
  347.             break;
  348.           case LG_OffsetX:
  349.             bounds.Left=data;
  350.             break;
  351.           case LG_OffsetY:
  352.             bounds.Top=data;
  353.             break;
  354.           case LG_BoundsWidth:
  355.             bounds.Width=data;
  356.             break;
  357.           case LG_BoundsHeight:
  358.             bounds.Height=data;
  359.             break;
  360.           case LG_Bounds:
  361.             bounds=*((struct IBox *)data);
  362.             break;
  363.           case LG_ScaleX:
  364.             lg_scalex=((float)data)/65535;
  365.             break;
  366.           case LG_ScaleY:
  367.             lg_scaley=((float)data)/65535;
  368.             break;
  369.           case LG_Justification:
  370.             lg_justification=data;
  371.             break;
  372.           case LG_UseScreenOffsets:
  373.             if(lg_usescreenoffsets=(struct Screen *)data)
  374.             {
  375.               lg_swoffsetx=lg_usescreenoffsets->WBorLeft;
  376.               lg_swoffsety=lg_usescreenoffsets->WBorTop + lg_usescreenoffsets->RastPort.TxHeight + 1;
  377.             }
  378.             else
  379.               lg_swoffsetx=lg_swoffsety=0;
  380.             break;
  381.           case LG_UseWindowOffsets:
  382.             if(lg_usewindowoffsets=(struct Window *)data)
  383.             {
  384.               lg_swoffsetx=lg_usewindowoffsets->BorderLeft;
  385.               lg_swoffsety=lg_usewindowoffsets->BorderTop;
  386.             }
  387.             else
  388.               lg_swoffsetx=lg_swoffsety=0;
  389.             break;
  390.             
  391.           case LG_GetMinWidth:
  392.             lg_getminwidth=(APTR)data;
  393.             break;
  394.           
  395.           case LG_GetMinHeight:
  396.             lg_getminheight=(APTR)data;
  397.             break;
  398.           
  399.           case LG_AddMinWidth:
  400.             lg_getminwidth=(APTR)data;
  401.             break;
  402.           
  403.           case LG_AddMinHeight:
  404.             lg_getminheight=(APTR)data;
  405.             break;
  406.  
  407.           case LG_CreateGadget:
  408.             cgptr=(struct Gadget **)data;
  409.             workgadget=newgadget;
  410.             
  411. //            WORD lg_FigureDim(struct LG_Control *Con, ULONG Code, struct IBox *Bounds,struct lg_DimInfo *Data)
  412.             
  413.             workgadget.ng_LeftEdge  =LG_FigureLeftEdge  (control, lg_leftedge,  &bounds, &diminfo);
  414.             workgadget.ng_TopEdge   =LG_FigureTopEdge   (control, lg_topedge,   &bounds, &diminfo);
  415.             workgadget.ng_Width     =LG_FigureWidth     (control, lg_width,     &bounds, workgadget.ng_LeftEdge, &diminfo);
  416.             workgadget.ng_Height    =LG_FigureHeight    (control, lg_height ,   &bounds, workgadget.ng_TopEdge,  &diminfo);
  417.  
  418. //            if(workgadget.ng_LeftEdge<0)
  419. //              workgadget.ng_LeftEdge += bounds.Width;
  420.             workgadget.ng_LeftEdge = (workgadget.ng_LeftEdge + bounds.Left) * lg_scalex + lg_swoffsetx;
  421.  
  422. //            if(workgadget.ng_TopEdge<0)
  423. //              workgadget.ng_TopEdge += bounds.Height;
  424.             workgadget.ng_TopEdge  = (workgadget.ng_TopEdge  + bounds.Top) * lg_scaley + lg_swoffsety;
  425.             
  426. //            if(workgadget.ng_Width<1)
  427. //              workgadget.ng_Width += bounds.Width;
  428.             workgadget.ng_Width  *= lg_scalex;
  429.             
  430. //            if(workgadget.ng_Height<1)
  431. //              workgadget.ng_Height += bounds.Height;
  432.             workgadget.ng_Height *= lg_scaley;
  433.  
  434.             ls_bottom= ls_top= ls_left= ls_right= 0;
  435.             
  436.             labelwidth=labelheight=0;
  437.             
  438.             if(workgadget.ng_GadgetText)
  439.             {
  440.               if(!(tf=OpenDiskFont(workgadget.ng_TextAttr)))
  441.               {
  442.                 workgadget.ng_TextAttr=&lg_Topaz8;
  443.                 tf=OpenFont(workgadget.ng_TextAttr);
  444.               }
  445.               
  446.               if(tf)
  447.               {
  448.                 UBYTE us[2]={0};
  449.                   
  450.                 us[0]=GetTagData(GT_Underscore,0,ngtaglist);
  451.                 
  452.                 labelwidth=gui_StrLength(SL_TextFont    ,tf,
  453.                                      SL_String      ,workgadget.ng_GadgetText,
  454.                                      SL_IgnoreChars ,us,
  455.                                      TAG_DONE)+8;
  456. //              printf("labelwidth=%d\n",labelwidth);
  457.                 labelheight=tf->tf_YSize+4;
  458.                 CloseFont(tf);
  459.               }
  460.             }
  461.               
  462.             switch(workgadget.ng_Flags & 0x1f)
  463.             {
  464.               case PLACETEXT_ABOVE:
  465.                 ls_top    =labelheight;
  466.                 break;
  467.               case PLACETEXT_BELOW:
  468.                 ls_bottom =labelheight;
  469.                 break;
  470.               case PLACETEXT_LEFT:
  471.                 ls_left   =labelwidth;
  472.                 break;
  473.               case PLACETEXT_RIGHT:
  474.                 ls_right  =labelwidth;
  475.                 break;
  476.             }
  477.             
  478.             if(fitlabel)
  479.             {
  480.               workgadget.ng_LeftEdge += ls_left;
  481.               workgadget.ng_Width    -=(ls_left + ls_right); 
  482.               workgadget.ng_TopEdge  += ls_top;
  483.               workgadget.ng_Height   -=(ls_top + ls_bottom); 
  484.             }
  485.             
  486.             if(lg_justification & LG_JUST_WITHLABEL)
  487.             {
  488.               js_left   =ls_left;
  489.               js_right  =ls_right;
  490.               js_top    =ls_top;
  491.               js_bottom =ls_bottom;
  492.             }
  493.             else
  494.               js_bottom= js_top= js_left= js_right= 0;
  495.             
  496.             if(fitlabel)
  497.               js2_bottom= js2_top= js2_left= js2_right= 0;
  498.             else
  499.             {
  500.               js2_left   =ls_left;
  501.               js2_right  =ls_right;
  502.               js2_top    =ls_top;
  503.               js2_bottom =ls_bottom;
  504.             }
  505.             
  506.             switch(lg_justification & LG_JUST_HORIZ_MASK)
  507.             {
  508.               case LG_JUST_LEFT:
  509.                 workgadget.ng_LeftEdge+=js_left;
  510.                 break;
  511.               case LG_JUST_HCENTER: //                Total Width             /2- left 
  512.                 workgadget.ng_LeftEdge-=(workgadget.ng_Width+js_left+js_right)/2-js2_left;
  513.                 break;
  514.               case LG_JUST_RIGHT:
  515.                 workgadget.ng_LeftEdge-=(workgadget.ng_Width+js_right);
  516.                 break;
  517.             }
  518.             
  519.             switch(lg_justification & LG_JUST_VERT_MASK)
  520.             {
  521.               case LG_JUST_TOP:
  522.                 workgadget.ng_TopEdge+=js_top;
  523.                 break;
  524.               case LG_JUST_VCENTER:
  525.                 workgadget.ng_TopEdge-=(workgadget.ng_Height+js_top+js_bottom)/2-js2_top;
  526.                 break;
  527.               case LG_JUST_RIGHT:
  528.                 workgadget.ng_TopEdge-=(workgadget.ng_Height+js_bottom);
  529.                 break;
  530.             }
  531.             
  532.             gad=CreateGadgetA(ngkind,gad,&workgadget,ngtaglist);
  533.  
  534.             if(lg_debug)
  535.             {
  536.               ULONG Array[2];
  537.               
  538.               Array[0]=(ULONG)gad;
  539.               Array[1]=workgadget.ng_GadgetID;
  540.               
  541.               VPrintf((STRPTR)"gaddr=%8lx gid=%ld\n",Array);
  542.             }
  543.             
  544.             if(errorptr)
  545.             {
  546.               if(gad==0 && *errorptr==-1)
  547.                 *errorptr=workgadget.ng_GadgetID;
  548.             }
  549.             
  550.             if(cgptr) 
  551.               *cgptr=gad;
  552.               
  553.             {
  554.               struct LG_GadgetIndex *gi;
  555.               
  556.               gi=&control->lgc_GadgetIndex[control->lgc_IndexCount];
  557.               lg_SetGadgetIndexAttrs(gi,ngtaglist);
  558.               
  559.               gi->gi_Gadget     =gad;
  560.               gi->gi_ID         =newgadget.ng_GadgetID;
  561.               gi->gi_GadKind    =ngkind;
  562.               gi->gi_KeyTagID   =KeyTag[ngkind];
  563.               gi->gi_KeyTagValue=GetTagData(KeyTag[ngkind],0,ngtaglist);
  564.               gi->gi_KeyClass   =gi_keyclass;
  565.               
  566.               if(!gi_keystring)
  567.               {
  568.                 if(newgadget.ng_GadgetText)
  569.                 {
  570.                   char *keychar;
  571.                   char scorechar;
  572.                   
  573.                   if(scorechar=GetTagData(GT_Underscore,0,ngtaglist))
  574.                   {
  575.                     if(keychar=strchr(newgadget.ng_GadgetText,scorechar))
  576.                     {
  577.                       keychar++;
  578.                       gi_kstring[0]=key_Unshifted(*keychar);
  579.                       gi_kstring[1]=key_Shifted(*keychar);
  580.                       gi_kstring[2]=0;
  581.                       gi_keystring=gi_kstring;
  582.                     }
  583.                   }
  584.                 }
  585.               }
  586.  
  587.               gi->gi_KeyString  =CopyString(gi_keystring,MEMF_PUBLIC); 
  588.               //printf("%s keystring=%s\n",newgadget.ng_GadgetText,gi->gi_KeyString);
  589.               gi_keystring=0;
  590.               
  591.               /* determine area displaced by gadget */
  592.               gi->gi_Rect.MinX=workgadget.ng_LeftEdge      - ls_left;
  593.               gi->gi_Rect.MinY=workgadget.ng_TopEdge       - ls_top;
  594.               gi->gi_Rect.MaxX=max(workgadget.ng_Width,0 ) + workgadget.ng_LeftEdge + ls_right;
  595.               gi->gi_Rect.MaxY=max(workgadget.ng_Height,0) + workgadget.ng_TopEdge + ls_bottom;
  596.  
  597.               control->lgc_Left  =min(control->lgc_Left   ,gi->gi_Rect.MinX);
  598.               control->lgc_Top   =min(control->lgc_Top    ,gi->gi_Rect.MinY);
  599.               control->lgc_Right =max(control->lgc_Right  ,gi->gi_Rect.MaxX);
  600.               control->lgc_Bottom=max(control->lgc_Bottom ,gi->gi_Rect.MaxY);
  601.  
  602. /*            
  603.               control->lgc_Left  =min(control->lgc_Left  ,workgadget.ng_LeftEdge  - ls_left);
  604.               control->lgc_Top   =min(control->lgc_Top   ,workgadget.ng_TopEdge   - ls_top);
  605.               control->lgc_Right =max(control->lgc_Right ,workgadget.ng_Width + workgadget.ng_LeftEdge + ls_right);
  606.               control->lgc_Bottom=max(control->lgc_Bottom,workgadget.ng_Height+ workgadget.ng_TopEdge + ls_bottom);
  607. */
  608.               control->lgc_IndexCount++;
  609.               newgadget.ng_GadgetID++;
  610.             }
  611.             break;
  612.  
  613.           case LG_EraseRemoved:
  614.             if(data)
  615.               control->lgc_Flags|=LGCF_ERASEREMOVED;
  616.             else
  617.               control->lgc_Flags&=(~LGCF_ERASEREMOVED);
  618.              break;
  619.  
  620.           case LG_KeyClass:
  621.             gi_keyclass=data;
  622.             break;
  623.  
  624.           case LG_KeyString:
  625.             gi_keystring=(STRPTR)data;
  626.             break;
  627.           case LG_RelHorizGap:
  628.             diminfo.GapHoriz=data;
  629.             break;
  630.           case LG_RelVertGap:
  631.             diminfo.GapVert=data;
  632.             break;  
  633.           case LG_HorizCells:
  634.             diminfo.CellsHoriz=data;
  635.             break;
  636.           case LG_VertCells:
  637.             diminfo.CellsVert=data;
  638.             break;          
  639.         } /* endswitch */
  640.       }
  641.       FreeTagItems(ngtaglist);
  642.       control->lgc_Right =max(control->lgc_Right ,control->lgc_Left);
  643.       control->lgc_Bottom=max(control->lgc_Bottom,control->lgc_Top);
  644.       gctr=control->lgc_GadgetList;
  645.       while(gctr)
  646.       {
  647.         control->lgc_GadgetCount++;
  648.         gctr=gctr->NextGadget;
  649.       }
  650.     }
  651.   }
  652.   if(!gad)
  653.   {
  654.     LG_FreeGadgets(control);
  655.     control=0;
  656.   }
  657.   return(control);
  658. }
  659.  
  660. /****** extras.lib/OBSOLETE_LG_FreeGadgets ******************************************
  661. *
  662. *   OBSOLETE
  663. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  664. *
  665. *   NAME
  666. *       LG_FreeGadgets - free gadgets allocated be LG_CreateGadgets.
  667. *
  668. *   SYNOPSIS
  669. *       LG_FeeeGadgets(Control)
  670. *
  671. *       void LG_FreeGadgets(struct LG_Control);
  672. *
  673. *   FUNCTION
  674. *       deallocates gadgets ans support structures allocated by 
  675. *        LG_CreateGadget
  676. *
  677. *   INPUTS
  678. *       Con - pointer to structure returned by LG_CreateGadgets.
  679. *
  680. *   RESULT
  681. *
  682. *   EXAMPLE
  683. *
  684. *   NOTES
  685. *       Gadgets created by LG_CreateGadgets() Must be freed using 
  686. *       LG_FreeGadgets OR Removed from it's Window using 
  687. *       LG_RemoveGadgets *BEFORE* the window is closed
  688. *
  689. *   BUGS
  690. *
  691. *   SEE ALSO
  692. *
  693. ******************************************************************************
  694. *
  695. */
  696.  
  697.  
  698. void LG_FreeGadgets(struct LG_Control *Con)
  699. {
  700.   struct LG_Control *next;
  701.   ULONG l;
  702.   
  703.   while(Con)
  704.   {
  705.     next=Con->lgc_Next;
  706.     
  707.     LG_RemoveGadgets(Con);
  708.     
  709.     for(l=0;l<Con->lgc_IndexCount;l++)
  710.     {
  711.       //printf("freeing %s %x\n",Con->lgc_GadgetIndex[l].gi_Gadget->GadgetText->IText,Con->lgc_GadgetIndex[l].gi_KeyString);
  712.       FreeVec(Con->lgc_GadgetIndex[l].gi_KeyString);
  713.     }
  714.     
  715.     FreeGadgets(Con->lgc_GadgetList);
  716.     FreeVec(Con->lgc_GadgetIndex);
  717.     FreeMem(Con,sizeof(struct LG_Control));
  718.  
  719.     Con=next;
  720.   }
  721. }
  722.  
  723. /****** extras.lib/OBSOLETE_LG_AddGadgets ******************************************
  724. *
  725. *   OBSOLETE
  726. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  727. *
  728. *   NAME
  729. *       LG_AddGadgets - Add gadgets to a window.
  730. *
  731. *   SYNOPSIS
  732. *
  733. *
  734. *
  735. *
  736. *
  737. *
  738. *   FUNCTION
  739. *
  740. *
  741. *   INPUTS
  742. *
  743. *   RESULT
  744. *
  745. *   EXAMPLE
  746. *
  747. *   NOTES
  748. *
  749. *   BUGS
  750. *
  751. *   SEE ALSO
  752. *
  753. ******************************************************************************
  754. *
  755. */
  756.  
  757.  
  758. void LG_AddGadgets(struct Window *Win, struct LG_Control *Con)
  759. {
  760.   if(Con)
  761.   {  
  762.     LG_RemoveGadgets(Con);  //Make sure there not already on another window.
  763.  
  764.     if(Con->lgc_GadgetList && Win) // If there's no gadgets, don't add em
  765.       if(Con->lgc_Window=Win)
  766.       {
  767.         AddGList(Win,Con->lgc_GadgetList,-1,Con->lgc_GadgetCount,0);
  768.         RefreshGList(Con->lgc_GadgetList,Win,0,Con->lgc_GadgetCount);
  769.         GT_RefreshWindow(Win,0);
  770.       }
  771.   }
  772. }
  773.  
  774. /****** extras.lib/OBSOLETE_LG_RemoveGadgets ******************************************
  775. *
  776. *   OBSOLETE
  777. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  778. *
  779. *   NAME
  780. *       LG_RemoveGadgets - remove gadgets from a window.
  781. *
  782. *   SYNOPSIS
  783. *
  784. *
  785. *
  786. *
  787. *
  788. *
  789. *   FUNCTION
  790. *
  791. *
  792. *   INPUTS
  793. *
  794. *   RESULT
  795. *
  796. *   EXAMPLE
  797. *
  798. *   NOTES
  799. *
  800. *   BUGS
  801. *
  802. *   SEE ALSO
  803. *
  804. ******************************************************************************
  805. *
  806. */
  807.  
  808.  
  809. void LG_RemoveGadgets(struct LG_Control *Con)
  810. {
  811.   struct Window *win;
  812.   struct RastPort *rp;
  813.   struct Gadget *g;
  814.   struct LG_GadgetIndex *gi;
  815.   ULONG l;
  816.   WORD x1,y1,x2,y2;
  817.   //WORD maxx,maxy,minx,miny;
  818.   //BOOL isntgzz;
  819.  
  820.   if(Con)
  821.   {  
  822.     win=Con->lgc_Window;
  823.     if(win)
  824.     {
  825.       if(Con->lgc_GadgetList)
  826.       {
  827.         rp=Con->lgc_Window->RPort;
  828.         RemoveGList(win, Con->lgc_GadgetList, Con->lgc_GadgetCount);
  829.   
  830.         g=Con->lgc_GadgetList;
  831.         
  832.         for(l=1;l<Con->lgc_GadgetCount;l++)
  833.           g=g->NextGadget;
  834.         
  835.         if(g)
  836.           g->NextGadget=0;
  837.         
  838.         gi=Con->lgc_GadgetIndex;
  839.         
  840.         //isntgzz=!(win->Flags & WFLG_GIMMEZEROZERO);
  841.         
  842.         /*
  843.         maxx=win->Width-win->BorderRight;
  844.         minx=win->BorderLeft;
  845.         maxy=win->Height-win->BorderBottom;
  846.         miny=win->BorderTop;
  847.         */
  848.         
  849.         if(Con->lgc_Flags & LGCF_ERASEREMOVED)
  850.         {
  851.           for(l=0;l<Con->lgc_IndexCount;l++)
  852.           {
  853.             x1=gi->gi_Rect.MinX;
  854.             y1=gi->gi_Rect.MinY;
  855.             x2=gi->gi_Rect.MaxX;
  856.             y2=gi->gi_Rect.MaxY;
  857.          
  858.             EraseRect(rp, x1, y1, x2, y2);
  859.             gi++;
  860.           }  
  861.         }
  862.       }
  863.       Con->lgc_Window=0;
  864.     }
  865.   }
  866. }
  867.  
  868. struct LG_GadgetIndex *LG_GetGI(struct LG_Control *Con, ULONG GadID)
  869. {
  870.   ULONG l;
  871.  
  872.   while(Con)
  873.   {
  874.     if(Con->lgc_GadgetIndex)
  875.     {
  876.       for(l=0; l<Con->lgc_IndexCount; l++)
  877.       {
  878.         if(GadID==Con->lgc_GadgetIndex[l].gi_ID)
  879.         {
  880.           return(&Con->lgc_GadgetIndex[l]);
  881.         }
  882.       }
  883.     }
  884.     Con=Con->lgc_Next;
  885.   }
  886.   return(0);
  887. }
  888.  
  889. BOOL LG_GetCAndGI(struct LG_Control *Con, ULONG GadID, struct CAndGI *CGI)
  890. {
  891.   ULONG l;
  892.  
  893.   while(Con)
  894.   {
  895.     if(Con->lgc_GadgetIndex)
  896.     {
  897.       for(l=0; l<Con->lgc_IndexCount; l++)
  898.       {
  899.         if(GadID==Con->lgc_GadgetIndex[l].gi_ID)
  900.         {
  901.           CGI->Control=Con;
  902.           CGI->GIndex=&Con->lgc_GadgetIndex[l];
  903.           return(1);
  904.         }
  905.       }
  906.     }
  907.     Con=Con->lgc_Next;
  908.   }
  909.   return(0);
  910. }
  911.  
  912.  
  913. /****** extras.lib/OBSOLETE_LG_GetGadget ******************************************
  914. *
  915. *   OBSOLETE
  916. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  917. *
  918. *   NAME
  919. *       LG_GetGadget - get a gadget pointer using Gadget ID.
  920. *
  921. *   SYNOPSIS
  922. *
  923. *
  924. *
  925. *
  926. *
  927. *
  928. *   FUNCTION
  929. *
  930. *
  931. *   INPUTS
  932. *
  933. *   RESULT
  934. *
  935. *   EXAMPLE
  936. *
  937. *   NOTES
  938. *
  939. *   BUGS
  940. *
  941. *   SEE ALSO
  942. *
  943. ******************************************************************************
  944. *
  945. */
  946.  
  947.  
  948. struct Gadget *LG_GetGadget(struct LG_Control *Con, ULONG GadID)
  949. {
  950.   struct LG_GadgetIndex *gi;
  951.  
  952.   if(gi=LG_GetGI(Con,GadID))
  953.     return(gi->gi_Gadget);
  954.   return(0);
  955. }
  956.  
  957. /*
  958. struct Gadget *LG_FindGadget(ULONG GadID, ULONG ConCount, struct LG_Control **Con, ... )
  959. {
  960.   struct Gadget *retval=0;
  961.   ULONG ct,l;
  962.   BOOL go=TRUE;
  963.  
  964.   if(Con)
  965.   {
  966.     for(ct=0;ct<ConCount && go;ct++)
  967.     {
  968.       if(Con[ct])
  969.       {
  970.         if(Con[ct]->lgc_GadgetIndex)
  971.         {
  972.           for(l=0; l<Con[ct]->lgc_IndexCount && go; l++)
  973.           {
  974.             if(GadID==Con[ct]->lgc_GadgetIndex[l].gi_ID)
  975.             {
  976.               retval=Con[ct]->lgc_GadgetIndex[l].gi_Gadget;
  977.               go=FALSE;
  978.             }
  979.           }
  980.         }
  981.       }
  982.     }
  983.   }
  984.   return(retval);
  985. }
  986. */
  987.  
  988. /****** extras.lib/OBSOLETE_LG_SetGadgetAttrs ******************************************
  989. *
  990. *   OBSOLETE
  991. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  992. *
  993. *   NAME
  994. *       LG_SetGadgetAttrs - set gadget attrs.
  995. *
  996. *   SYNOPSIS
  997. *
  998. *
  999. *
  1000. *
  1001. *
  1002. *
  1003. *   FUNCTION
  1004. *
  1005. *
  1006. *   INPUTS
  1007. *
  1008. *   RESULT
  1009. *
  1010. *   EXAMPLE
  1011. *
  1012. *   NOTES
  1013. *
  1014. *   BUGS
  1015. *
  1016. *   SEE ALSO
  1017. *
  1018. ******************************************************************************
  1019. *
  1020. */
  1021.  
  1022.  
  1023.  
  1024. BOOL LG_SetGadgetAttrs(struct LG_Control *Con, ULONG GadID, Tag Tags, ...)
  1025. {
  1026.   BOOL rv=FALSE;
  1027.   struct CAndGI cgi;
  1028.   
  1029.   if(LG_GetCAndGI(Con,GadID,&cgi))
  1030.   {
  1031.     if(GadToolsBase->lib_Version>=39 || cgi.Control->lgc_Window)
  1032.     {
  1033.       rv=TRUE;
  1034.       GT_SetGadgetAttrsA(cgi.GIndex->gi_Gadget,cgi.Control->lgc_Window,0,(struct TagItem *)&Tags);
  1035.       lg_SetGadgetIndexAttrs(cgi.GIndex,(struct TagItem *)&Tags);
  1036.     }
  1037.   }
  1038.   return(rv);
  1039. }
  1040.  
  1041. /****** extras.lib/OBSOLETE_LG_GetGadgetAttrs ******************************************
  1042. *
  1043. *   OBSOLETE
  1044. *       Since OS3.5 uses Reaction/ClassAct - this code is obsolete
  1045. *
  1046. *   NAME
  1047. *       LG_GetGadgetAttrs
  1048. *
  1049. *   SYNOPSIS
  1050. *
  1051. *
  1052. *
  1053. *
  1054. *
  1055. *
  1056. *   FUNCTION
  1057. *
  1058. *
  1059. *   INPUTS
  1060. *
  1061. *   RESULT
  1062. *
  1063. *   EXAMPLE
  1064. *
  1065. *   NOTES
  1066. *
  1067. *   BUGS
  1068. *
  1069. *   SEE ALSO
  1070. *
  1071. ******************************************************************************
  1072. *
  1073. */
  1074.  
  1075.  
  1076. ULONG LG_GetGadgetAttrs(struct LG_Control *Con, ULONG GadID, Tag Tags, ...)
  1077. {
  1078.   ULONG rv=0;
  1079.   struct CAndGI cgi;
  1080.   
  1081.   if(GadToolsBase->lib_Version>=39)
  1082.   {
  1083.     if(LG_GetCAndGI(Con,GadID,&cgi))
  1084.     {
  1085.       rv=GT_GetGadgetAttrsA(cgi.GIndex->gi_Gadget,cgi.Control->lgc_Window,0,(struct TagItem *)&Tags);
  1086.     }
  1087.   }
  1088.   return(rv);
  1089. }
  1090.  
  1091. /*
  1092. struct IntuiMessage *LG_GetIMsg(struct LG_Control *Con, struct MsgPort *IntuiPort)
  1093. {
  1094.   struct IntuiMessage *imsg=0,*newimsg;
  1095.   ULONG l,icode,iclass;
  1096.  
  1097.   if(IntuiPort)
  1098.   {
  1099.     if(imsg=GT_GetIMsg(IntuiPort))
  1100.     {
  1101.       if(Con)
  1102.       {
  1103.         icode =imsg->Code;
  1104.         iclass=imsg->Class;
  1105.         switch(imsg->Class)
  1106.         {
  1107.           case IDCMP_RAWKEY:
  1108.           case IDCMP_VANILLAKEY:
  1109.             for(l=0;l<Con->lgc_IndexCount;l++)
  1110.             {
  1111.               if(Con->lgc_GadgetIndex[l].KeyClass==imsg->iclass)
  1112.               {
  1113.                 if(Con->lgc_GadgetIndex[l].KeyUp   == icode)
  1114.                 {
  1115.                   newimsg=CopyIMsg(imsg);         
  1116.                   newimsg->Class=IDCMP_GADGETUP;
  1117.                   newimsg->Code=1;
  1118.                   newimsg->
  1119.                 }
  1120.                 if(Con->lgc_GadgetIndex[l].KeyDown == icode)
  1121.               }
  1122.             } 
  1123.         }
  1124.       }
  1125.     }
  1126.   }
  1127.   return(imsg);
  1128. }
  1129.   
  1130. struct IntuiMessage *CopyIMsg(struct IntuiMessage *IMsg)
  1131. {
  1132.   struct IntuiMessage *i;
  1133.   
  1134.   if(i=AllocVec(sizeof(struct IntuiMessage),MEMF_PUBLIC))
  1135.   {
  1136.     *i=*IMsg;
  1137.   }
  1138.  
  1139.   return(i);
  1140. }
  1141. }*/
  1142.  
  1143. void lg_FixTagList(struct LG_Control *Con, struct TagItem *TagList)
  1144. {
  1145.   ULONG data;
  1146.   struct TagItem    *tag, 
  1147.                     *tstate;
  1148.   ProcessTagList(TagList,tag,tstate)
  1149.   {
  1150.     data=tag->ti_Data;
  1151.     switch(tag->ti_Tag)
  1152.     {
  1153.       case GTLV_ShowSelected:
  1154.         if(data)
  1155.         {
  1156.           tag->ti_Data=(ULONG)LG_GetGadget(Con,data);
  1157.         }
  1158.         break;
  1159.    }
  1160.   }
  1161. }
  1162.  
  1163. //ULONG LG_GadIDFromIE()
  1164.  
  1165. BOOL LG_GadForKey(struct LG_Control *Con, UBYTE Key, ULONG *GadID, ULONG *Code)
  1166. {
  1167.   char *c;
  1168.   ULONG l;
  1169.  
  1170.   if(Con)
  1171.   {
  1172.     if(Con->lgc_GadgetIndex)
  1173.     {
  1174.       for(l=0; l<Con->lgc_IndexCount; l++)
  1175.       {
  1176.         if(Con->lgc_GadgetIndex[l].gi_KeyString && Con->lgc_GadgetIndex[l].gi_Disabled==0)
  1177.         {
  1178.           if(c=strchr(Con->lgc_GadgetIndex[l].gi_KeyString,Key))
  1179.           {
  1180.             *Code=((ULONG)c)-((ULONG)Con->lgc_GadgetIndex[l].gi_KeyString);
  1181.             *GadID=Con->lgc_GadgetIndex[l].gi_Gadget->GadgetID;
  1182.             return(1);
  1183.           }
  1184.         }
  1185.       }
  1186.     }
  1187.   }
  1188.   return(0);
  1189. }
  1190.  
  1191. void lg_SetGadgetIndexAttrs(struct LG_GadgetIndex *GI, struct TagItem *TagList)
  1192. {
  1193.   GI->gi_Disabled=GetTagData(GA_Disabled, GI->gi_Disabled, TagList);
  1194. }
  1195.  
  1196. void LG_AddLGControl(struct LG_Control *Parent, struct LG_Control *Child)
  1197. {
  1198.   if(Child && Parent)
  1199.   {
  1200.     Child->lgc_Next=Parent->lgc_Next;
  1201.     Parent->lgc_Next=Child;
  1202.   }
  1203. }
  1204.  
  1205. BOOL LG_RemoveLGControl(struct LG_Control *Parent, struct LG_Control *Child)
  1206. {
  1207.   struct LG_Control *work;
  1208.   
  1209.   if(Child && Parent)
  1210.   {
  1211.     work=Parent;
  1212.     if(work->lgc_Next==Child)
  1213.     {
  1214.       work->lgc_Next=Child->lgc_Next;
  1215.       return(1);
  1216.     }
  1217.   }
  1218.   return(0);
  1219. }
  1220.  
  1221. /*
  1222. union Decode
  1223. {
  1224.   ULONG Long;
  1225.   struct
  1226.   {
  1227.     BYTE Type, Code;
  1228.     WORD Word;
  1229.   } Decode;
  1230. };
  1231.  
  1232. WORD lg_FigureDim(struct LG_Control *Con, ULONG Code, struct IBox *Bounds,struct lg_DimInfo *Data)
  1233. {
  1234.   struct LG_GadgetIndex *gi;
  1235.   union Decode command;
  1236.   WORD word,w,h,retval;
  1237.   BYTE code;
  1238.  
  1239.   command.Long=Code;
  1240.   word=command.Decode.Word;
  1241.   code=command.Decode.Code;
  1242.   
  1243.   retval=word;
  1244.   
  1245. //  le =Bounds->Left;
  1246. //  te =Bounds->Top;
  1247.   w  =Bounds->Width;
  1248.   h  =Bounds->Height ;
  1249.   
  1250.   switch(command.Type)
  1251.   {
  1252.     case 1:
  1253.       switch(command.Decode.Code)
  1254.       {
  1255.         case 0: // LG_REL_RIGHT
  1256.           retval=(w + word);
  1257.           break;
  1258.         case 1: // LG_REL_WIDTH
  1259.           retval=(w + word);    
  1260.           break;
  1261.         case 2: // LG_REL_BOTTOM
  1262.           retval=(h + word);
  1263.           break;
  1264.         case 3: // LG_REL_HEIGHT
  1265.           retval=(h + word);    
  1266.           break;
  1267.         case 4: // LG_REL_CELL_LEFTEDGE
  1268.           if(Data->CellsHoriz)
  1269.             retval=((word * Bounds->Width + Data->GapHoriz)/Data->CellsHoriz);
  1270.           break;         
  1271.         case 5: // LG_RELCELL_TOPEDGE
  1272.           if(Data->CellsVert)
  1273.             retval=((word * Bounds->Height+ Data->GapVert)/Data->CellsVert);
  1274.           break;
  1275.         case 6: // LG_REL_CELL_WIDTH
  1276.           if(Data->CellsHoriz)
  1277.             retval=((word * (Bounds->Width + Data->GapHoriz))/Data->CellsHoriz - Data->GapHoriz);
  1278.           else
  1279.             retval=(Bounds->Width);
  1280.           break;          
  1281.         case 7: // LG_REL_CELL_HEIGHT
  1282.           if(Data->CellsVert)
  1283.             retval=((word * (Bounds->Height + Data->GapVert))/Data->CellsVert - Data->GapVert);
  1284.           else
  1285.             retval=(Bounds->Width);
  1286.           break;          
  1287.       }
  1288.       break;
  1289.     case 2: // LG_REL_LEFTOF
  1290.       if(gi=LG_GetGI(Con,word))
  1291.       {
  1292.         retval=(gi->gi_Rect.MinX+code);
  1293.       }
  1294.       break;
  1295.     case 3: // LG_REL_TOPOF
  1296.       if(gi=LG_GetGI(Con,word))
  1297.       {
  1298.         retval=(gi->gi_Rect.MinY+code);
  1299.       }
  1300.       break;
  1301.     case 4: // LG_REL_WIDTHOF
  1302.       if(gi=LG_GetGI(Con,word))
  1303.       {
  1304.         retval=(gi->gi_Rect.MaxX-gi->gi_Rect.MinX+code);
  1305.       }
  1306.       break;      
  1307.     case 5: // LG_REL_HEIGHTOF
  1308.       if(gi=LG_GetGI(Con,word))
  1309.       {
  1310.         retval=(gi->gi_Rect.MaxY-gi->gi_Rect.MinY+code);
  1311.       }
  1312.       break;      
  1313.     case 6: // LG_REL_RIGHTOF
  1314.       if(gi=LG_GetGI(Con,word))
  1315.       {
  1316.         retval=(gi->gi_Rect.MaxX+code);
  1317.       }
  1318.       break;      
  1319.     case 7: // LG_REL_BOTTOMOF
  1320.       if(gi=LG_GetGI(Con,word))
  1321.       {
  1322.         retval=(gi->gi_Rect.MaxY+code);
  1323.       }
  1324.       break;      
  1325.   }
  1326.   return(retval);
  1327. }
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333. */
  1334.